<?php

class User_Form_Verify extends Front_Base_Form_Horizontal
{

    public function getFormId()
    {
        $className = get_class($this);
        return strtolower($className);
    }

    public function init()
    {
        $this->setIsArray(true);
        //$this->setElementsBelongTo('bootstrap');

        $this->_addClassNames('form-verify');

        // Verify code
        $this->addElement('text', 'verifycode', array(
            'id' => $this->getFormId().'_verifycode',
            'label' => $this->getView()->translate('VERIFY_CODE'),
            'maxlength' => 6
        ));
        $this->getElement('verifycode')
        ->addFilter('StringTrim')
        ->setRequired(true)
        ->addValidators(array(
            array('NotEmpty', true),
            array('Digits'),
            array('StringLength', false, array(1, 6)),
        ));
        
        // Email
        $this->addElement('hidden', 'email', array(
            'id' => $this->getFormId().'_email',
            'maxlength' => 100
        ));
        $this->getElement('email')
        ->addFilter('StringTrim')
        ->addFilter('StripTags')
        ->setRequired(true)
        ->addValidators(array(
            array('NotEmpty', true),
            array('stringLength', false, array(3, 100)),
            array('EmailAddress')
        ));
    }

}